package com.bocloud.cmp.dao;

import java.util.List;
import java.util.Map;

import com.bocloud.cmp.entity.ApproveNode;
import com.bocloud.common.model.Param;
import com.bocloud.database.core.intf.GenericDao;

/**
 * 审批DAO接口
 * 
 * @author dongkai
 *
 */
public interface ApproveNodeDao extends GenericDao<ApproveNode, Long> {

	/**
	 * 分页查询
	 * 
	 * @param page
	 * @param rows
	 * @param params
	 * @param sorter
	 * @return
	 * @throws Exception
	 */
	public List<ApproveNode> list(int page, int rows, List<Param> params, Map<String, String> sorter) throws Exception;

	/**
	 * 根据申请ID查询
	 * 
	 * @param applyId
	 * @return
	 * @throws Exception
	 */
	public List<ApproveNode> listByAid(Long applyId) throws Exception;

	/**
	 * 根据审批人ID和状态查询
	 * 
	 * @param userId
	 * @param status
	 * @return
	 * @throws Exception
	 */
	public List<ApproveNode> listByUid(Long userId, String status) throws Exception;

	/**
	 * 根据优先级、申请ID查询
	 * 
	 * @param applyId
	 * @param priority
	 * @return
	 * @throws Exception
	 */
	public ApproveNode get(Long applyId, Integer priority) throws Exception;

	/**
	 * 获取数量
	 * 
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public int count(List<Param> params) throws Exception;

	/**
	 * 根据ID删除
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public boolean delete(Long id, Long userId) throws Exception;

	/**
	 * 根据ID查询
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public ApproveNode query(Long id) throws Exception;
}
